import React from "react";
import { Link, Routes, Route } from "react-router-dom";

const Home = () => {
  return <div>这是首页</div>;
};
const About = () => {
  return <div>这是关于页</div>;
};

const App = () => {
  return (
    <>
      <h2>router-v6-basic</h2>
      <ul>
        <li>
          <Link to="/">首页</Link>
        </li>
        <li>
          <Link to="/about">关于页</Link>
        </li>
      </ul>

      <hr />

      {/* Switch变成了Routes, Routes现在必要要加 */}
      <Routes>
        {/* 里面还是用Route */}
        {/* 4种方式变成了element一种 */}
        {/* element里面要写标签 */}

        {/* v6就是精准匹配 */}
        {/* v6现在是排他性路由 */}
        <Route path="/" element={<Home />}></Route>
        <Route path="/about" element={<About />}></Route>
      </Routes>
    </>
  );
};

export default App;
